package d0324;

public class Sheep2 {

        private String name;
        private int age;

        public Sheep2(String name, int age) {
            this.name = name;
            this.age = age;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;

        }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
       // Sheep2 s=(Sheep2) super.clone();
      //  s.name=new String(s.name);
    }

    public static void main(String[] args) {
            Sheep2 s1 = new Sheep2("Alice", 3);
            try {
                Sheep2 duoli = (Sheep2) s1.clone();
                System.out.println("s1==duoli:" + (s1 == duoli));
                System.out.println(duoli.name + "\t" + duoli.age);
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
            }
        }
    }

